<html>

<head>
<meta charset="UTF-8">
<title>角色管理</title>
</head>
<body>
	<script type="text/javascript" src="/js/role.js"></script>
	<#import "/page.ftl" as page />
	<#include "/head.ftl"/>
	<div class="content">
		<div class="tab">
			<div class="tab-header">
				<a href="/role/add" title="添加角色" class="btn btn-setting btn-add" id="add"> <i class="iconfont icon-add"
					style="font-size: 16px;"></i>
				</a>
				<a title="刷新" class="btn btn-setting" onclick="refresh(this)">
					<i class="iconfont icon-refresh"></i>
				</a>
				<div class="tab-tool">
					<input name="search" type="text" placeholder="查找...">
					<a class="search-btn">
						<i class="iconfont icon-search"></i>
					</a>

				</div>
			</div>
			<div class="tab-content">
				<div>
					<table style="width: 100%; border-collapse: collapse;">
						<tr>
							<#assign sort=roles.sort?replace(': ',',') />
							<th>序号</th>
							<th>角色名称</th>
							<th>角色描述</th>
							<th>可用权限</th>
							<th>权限值</th>
							<th class="tab-setting">操作</th>
						</tr>
						<#list (roles.content) as role>
							<tr>
								<td>${role_index+1}</td>
								<td>${role.name}</td>
								<td>${role.describe}</td>
								<td class="menu-texts" style="max-width: 300px;">
									<#list role.menus as menu>
										${menu.text}
									</#list>
								</td>
								<td>${role.powerValue}</td>
								<td>
									<a onclick="changeAuth(this)" class="btn btn-up"><i class="iconfont icon-Key"></i><span> 角色授权</span></a>
									<#assign id="" />
									<#list role.menus as menu>
										<#assign id=id+menu.id />
										<#if menu_index != role.menus?size-1>
											<#assign id=id+"," />
										</#if>
									</#list>
									<div data-menus="${id}" data-id="${role.id}" style="display: none;padding: 10px 0px;">正在加载请稍候……</div>
									<a href="/role/getone?id=${role.id}" class="btn btn-update"><i class="iconfont icon-brush"></i><span> 修改</span></a>
									<a onclick="deleteOne(${role.id},'/role/delete')" class="btn btn-delete"><i class="iconfont icon-trash"></i><span> 删除</span></a>
								</td>
							</tr>
						</#list>
					</table>
				</div>
			</div>
			<@page.page url=requestURI pager=roles/>
		</div>
	</div>
</body>
</html>